﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GContatos.aspx.cs" MasterPageFile="~/CRM.Master"
    Inherits="crm.aplicacao.CRMSystem.GContatos" %>

<%@ Register Assembly="Ext.Net.UX" Namespace="Ext.Net.UX" TagPrefix="ux" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <ext:Store ID="strEmpresas" runat="server">
        <Reader>
            <ext:JsonReader IDProperty="idempresas">
                <Fields>
                    <ext:RecordField Name="idempresas" />
                    <ext:RecordField Name="empresa" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:Store ID="strPais" runat="server">
        <Reader>
            <ext:JsonReader IDProperty="idpais">
                <Fields>
                    <ext:RecordField Name="idpais" />
                    <ext:RecordField Name="nome" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:Store ID="strEstado" runat="server">
        <Reader>
            <ext:JsonReader IDProperty="idestado">
                <Fields>
                    <ext:RecordField Name="idestado" />
                    <ext:RecordField Name="estado" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:Store ID="strCidade" runat="server">
        <Reader>
            <ext:JsonReader IDProperty="idcidade">
                <Fields>
                    <ext:RecordField Name="idcidade" />
                    <ext:RecordField Name="cidade" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:GridPanel ID="GridContatos" runat="server" Title="Gerência de Contatos" AutoScroll="true"
        AutoWidth="true" Height="900">
        <Store>
            <ext:Store ID="strContatos" runat="server">
                <Reader>
                    <ext:JsonReader IDProperty="idcontatos">
                        <Fields>
                            <ext:RecordField Name="idcontatos" />
                            <ext:RecordField Name="contato" />
                            <ext:RecordField Name="empresa" />
                            <ext:RecordField Name="email" />
                            <ext:RecordField Name="telefone" />
                            <ext:RecordField Name="celular" />
                            <ext:RecordField Name="pais" />
                            <ext:RecordField Name="estado" />
                            <ext:RecordField Name="cidade" />
                            <ext:RecordField Name="cargo" />
                            <ext:RecordField Name="observacao" />
                        </Fields>
                    </ext:JsonReader>
                </Reader>
            </ext:Store>
        </Store>
        <TopBar>
            <ext:Toolbar ID="ToolbarContatos" runat="server" AutoWidth="true">
                <Items>
                    <ext:Button ID="btNovoContatos" runat="server" Text="Novo" Icon="Add">
                        <Listeners>
                            <Click Handler="#{WindowsNovoContatos}.show()" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button ID="btEditarContatos" runat="server" Text="Editar" Icon="PageWhiteEdit">
                        <Listeners>
                            <Click Handler="Ext.net.DirectMethods.editar();" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button ID="btRemoverContatos" runat="server" Text="Remover" Icon="Delete">
                        <Listeners>
                            <Click Handler="Ext.net.DirectMethods.remover();" />
                        </Listeners>
                    </ext:Button>
                </Items>
            </ext:Toolbar>
        </TopBar>
        <ColumnModel ID="ColumnModel1" runat="server">
            <Columns>
                <ext:Column ColumnID="colNomeContatos" Header="Contatos" Width="160" DataIndex="contato" />
                <ext:Column ColumnID="colNomeEmpresas" Header="Empresas" Width="160" DataIndex="empresa" />
                <ext:Column ColumnID="colEmailContatos" Header="Email" Width="160" DataIndex="email" />
                <ext:Column ColumnID="colTelefoneContatos" Header="Telefone" Width="160" DataIndex="telefone" />
                <ext:Column ColumnID="colCelularContatos" Header="Celular" Width="160" DataIndex="celular" />
                <ext:Column ColumnID="colNomePais" Header="País" Width="160" DataIndex="pais" />
                <ext:Column ColumnID="colNomeEstado" Header="Estado" Width="160" DataIndex="estado" />
                <ext:Column ColumnID="colNomeCidade" Header="Cidade" Width="160" DataIndex="cidade" />
                <ext:Column ColumnID="colCargoContatos" Header="Cargo" Width="160" DataIndex="cargo" />
                <ext:Column ColumnID="colObservacaoContatos" Header="Observação" Width="160" DataIndex="observacao" />
            </Columns>
        </ColumnModel>
        <SelectionModel>
            <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true" />
        </SelectionModel>
        <BottomBar>
            <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="20" />
        </BottomBar>
        <LoadMask ShowMask="true" />
    </ext:GridPanel>
    <ext:Window ID="WindowsNovoContatos" runat="server" Icon="FlagBr" Title="Dados do Contato"
        Hidden="true" Modal="true" Width="430" AutoHeight="true" Resizable="false">
        <Items>
            <ext:FormPanel ID="FormNovoContatos" runat="server" Padding="5" Layout="Anchor" BodyStyle="background-color: transparent;"
                Header="false">
                <Items>
                    <ext:TextField ID="txtNomeContatos" runat="server" FieldLabel="Nome" AnchorHorizontal="93%"
                        AllowBlank="false" MsgTarget="Side" />
                    <ext:TextField ID="txtEmailContatos" runat="server" FieldLabel="Email" AnchorHorizontal="93%"
                        AllowBlank="false" MsgTarget="Side" />
                    <ext:TextField ID="txtTelefoneContatos" runat="server" FieldLabel="Telefone" AnchorHorizontal="93%"
                        AllowBlank="false" MsgTarget="Side">
                        <Plugins>
                            <ux:InputTextMask ID="InputTextMask3" runat="server" Mask="(99)9999-9999" />
                        </Plugins>
                    </ext:TextField>
                    <ext:TextField ID="txtCelularContatos" runat="server" FieldLabel="Celular" AnchorHorizontal="93%"
                        MsgTarget="Side">
                        <Plugins>
                            <ux:InputTextMask ID="InputTextMask4" runat="server" Mask="(99)9999-9999" />
                        </Plugins>
                    </ext:TextField>
                    <ext:ComboBox ID="cboEmpresaContatos" runat="server" FieldLabel="Empresa" AnchorHorizontal="93%"
                        AllowBlank="false" MsgTarget="Side" StoreID="strEmpresas" ValueField="idempresas"
                        DisplayField="empresa" />
                    <ext:ComboBox ID="cboPaisContatos" runat="server" FieldLabel="País" AnchorHorizontal="93%"
                        AllowBlank="false" MsgTarget="Side" StoreID="strPais" ValueField="idpais" DisplayField="nome" />
                    <ext:ComboBox ID="cboEstadoContatos" runat="server" FieldLabel="Estado" AnchorHorizontal="93%"
                        AllowBlank="false" MsgTarget="Side" StoreID="strEstado" ValueField="idestado"
                        DisplayField="estado">
                        <Listeners>
                            <Select Handler="Ext.net.DirectMethods.reload(); " />
                        </Listeners>
                    </ext:ComboBox>
                    <ext:ComboBox ID="cboCidadeContatos" runat="server" FieldLabel="Cidade" AnchorHorizontal="93%"
                        AllowBlank="false" MsgTarget="Side" StoreID="strCidade" ValueField="idcidade"
                        DisplayField="cidade" />
                    <ext:TextField ID="txtCargoContatos" runat="server" FieldLabel="Cargo" AnchorHorizontal="93%"
                        AllowBlank="false" MsgTarget="Side" />
                    <ext:TextArea ID="txtObservacaoContatos" runat="server" FieldLabel="Observação" AnchorHorizontal="93%"
                        AllowBlank="false" MsgTarget="Side" />
                </Items>
                <Buttons>
                    <ext:Button ID="btGravarContatos" runat="server" Text="Gravar" Icon="Disk">
                        <Listeners>
                            <Click Handler="Ext.net.DirectMethods.inserir();" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button ID="btCancelar" runat="server" Text="Cancelar" Icon="Cancel">
                        <Listeners>
                            <Click Handler="#{WindowsNovoContatos}.hide();" />
                        </Listeners>
                    </ext:Button>
                </Buttons>
            </ext:FormPanel>
        </Items>
        <Listeners>
            <Close Handler="Ext.net.DirectMethods.limparCampo();" />
            <Hide Handler="Ext.net.DirectMethods.limparCampo();" />
        </Listeners>
    </ext:Window>
    <ext:Hidden ID="hdfIdContatos" runat="server" />
</asp:Content>
